package com.dubbo.demo.consumer;

import java.io.IOException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.dubbo.demo.api.IHelloWorld;

/**
 * 启动消费者服务
 * @author xbq
 */
public class Main {

	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("consumer.xml");
		context.start();
		
		IHelloWorld helloWorld = (IHelloWorld)context.getBean("helloService");
		String str = helloWorld.sayHello("徐邦启");
		System.out.println(str);
		
		try {
			// 为保证服务一直开着，利用输入流的阻塞来模拟 
			System.in.read();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
